{extend name="public/base" /}

{block name="body"}

  <div class="layui-form" lay-filter="layuiadmin-form-addons" id="layuiadmin-form-addons" style="padding: 20px 40px 0 0;">
    <div class="layui-form-item">
      <label class="layui-form-label">名称</label>
      <div class="layui-input-inline">
        <input type="text" name="addons_name" lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input">
      </div>
    </div>
	<div class="layui-form-item">
      <label class="layui-form-label">版本</label>
      <div class="layui-input-inline">
        <input type="text" name="addons_version" lay-verify="required" placeholder="请输入版本" autocomplete="off" class="layui-input">
      </div>
    </div>
	<div class="layui-form-item">
      <label class="layui-form-label">作者</label>
      <div class="layui-input-inline">
        <input type="text" name="addons_auther" lay-verify="required" placeholder="请输入作者名" autocomplete="off" class="layui-input">
      </div>
    </div>
	<div class="layui-form-item">
      <label class="layui-form-label">简介</label>
      <div class="layui-input-inline">
	  <textarea name="addons_resume" placeholder="请输入简介"  lay-verify="required"  class="layui-textarea"></textarea>
      </div>
    </div>
	<div class="layui-form-item">
      <label class="layui-form-label">价格</label>
      <div class="layui-input-inline">
        <input type="text" name="addons_price" lay-verify="required" placeholder="请输入价格" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item  layui-form-text">
      <label class="layui-form-label">压缩包</label>
      <div class="layui-input-inline">
        <input type="text" name="addons_src" lay-verify="required" placeholder="请上传zip包" autocomplete="off" class="layui-input" >
      </div>
    </div>
	<div class="layui-form-item  layui-form-text">
      <label class="layui-form-label"></label>
      <div class="layui-input-inline">
       <button style="float: left;" type="button" class="layui-btn " id="layuiadmin-upload-addons">上传插件</button>
      </div>
    </div>
    <div class="layui-form-item layui-hide">
      <input type="button" lay-submit lay-filter="LAY-addons-submit" id="LAY-addons-submit" value="确认">
    </div>
  </div>

{/block}
{block name="js"}  
  <script>
  layui.config({
    base: '/static/admin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form', 'upload'], function(){
    var $ = layui.$
    ,form = layui.form
    ,upload = layui.upload ;
	
    upload.render({
      elem: '#layuiadmin-upload-addons'
      ,url: 'uploadZip'
      ,accept: 'file'
	  ,field: 'file'
      ,method: 'get'
      ,exts: 'zip|rar|7z'
      ,done: function(res){
		$(this.item).prev("div").children("input").val(res.src)
		
			if(res.code == 0){
				layer.msg(res.msg,{
					icon:6,
					tiye:2000
				});
			} else {
				layer.open({
					title:"上传失败",
					content:res.msg,
					icon:5,
					anim:6
				});
			}
      }
    });
  })
  </script>
{/block}